<!-- create begin -->
<div class=" create">
   
    <!-- 表单 -->   
    <section class="panel-body" >
            <form role="form" class="form-create">


                <div class="form-group col-sm-12">
                    <span>库位名称</span>
                    <input type="text" class="form-control" placeholder="库位名称" name="name">
                </div>

                <div class="form-group col-sm-12">
                    <span>状态</span>
                    <div class="radio">
                        <label><input type="radio" name="status" value="0" checked="checked">正常</label>
                    </div>
                    <div class="radio">
                        <label><input type="radio" name="status" value="1" >禁用</label>
                    </div>
                </div>

                <div class="form-group col-sm-12">
                    <span>货架</span>
                    <textarea class="form-control" cols="5" name="shelve"></textarea>
                    <span>请以英文,号分割,例如: A,B,C,D</span>
                </div>

                <div class="form-group col-sm-12">
                    <span>备注</span>
                    <textarea class="form-control" cols="5" name="desc"></textarea>
                </div>

            </form>
    </section>

    <div class="form-group col-sm-12 panel-footer bg-none">
        <button type="button" class="btn btn-sm btn btn-primary" @click="save">  保 存 </button>
        <button type="reset" class="btn btn-sm btn-success ">  重 置 </button> 
    </div>


</div>
<!-- create end-->

<script>

// seajs
seajs.use([],function() {

    var create = new Vue({
        el: '.create',
        data: {},
        methods: {
            save: function () {
                var param = $('.form-create').serializeArray();
                $.ajax({
                    url: "{:url('save')}",
                    method: 'POST',
                    dataType: 'json',
                    data: param,
                    success: this.callback
                });
            },
            callback:function (data) {
                if( data.error >0 ){
                    toastr.error(data.msg);
                }else{
                    toastr.success(data.msg);
                    Table.methods.refresh();
                    layer.closeAll('page');
                }
            }
        }

    });

});

</script>